package com.ssh.action;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.ActionSupport;
import com.ssh.entity.User;
import com.ssh.service.UserService;

public class UserAction extends ActionSupport{
	@Autowired
	private UserService userService;
	public String index(){
		return "index";
	}
	public String register(){
		HttpServletRequest request=ServletActionContext.getRequest();
		String username=request.getParameter("register_username");
		String password=request.getParameter("register_password");
		System.out.println(username);
		System.out.println(password);
		User user=new User();
		user.setUsername(username);
		user.setPassword(password);
		userService.register(user);
		//System.out.println(user);
		return "register_success";
	}
	
}
